<extend name="Common/common" />
<block name="main">
    <div id="page-wrapper" class="gray-bg dashbard-1">
        <include file="Common/nav-header"/> <!--顶部-->
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>添加初级类别</h5>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal m-t " method="post" action="<{:U('add')}>" enctype="multipart/form-data">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">博客类型：</label>
                            <div class="col-sm-9">
                                <select id="typeid" name="typeid">
                                    <option value="0">请选择分类类型</option>
                                    <foreach name="type" item="vo">
                                        <option value="<{$vo.id}>"><{$vo.type}></option>
                                    </foreach>
                                </select>
                            </div>
                        </div>
                        
						 
                        <div class="form-group">
                            <label class="col-sm-3 control-label">名称：</label>
                            <div class="col-sm-3">
                                <input  type="text" id="title" class="form-control" name="title" value="<{$data.title}>">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">图片链接：</label>
                            <div class="col-sm-3">
                                <input  type="text" id="href" class="form-control" name="image" value="<{$data.href}>">
                            </div>
                        </div>
                        
                        <div class="form-group">
                            <label class="col-sm-3 control-label">是否推荐：</label>
                            <div class="col-sm-6">
                                <input type="radio" name="is_recommend" value="0"> 否
                                <input type="radio" name="is_recommend" value="1"> 是
                                <span style="color:indianred">（推荐后，会在首页右侧显示）</span>
                            </div>
                        </div>
                        
                        <div class="form-group">
                            <label class="col-sm-3 control-label">作者：</label>
                            <div class="col-sm-3">
                                <input  type="text" id="author" class="form-control" name="author" value="<{$data.sort}>">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">摘要：</label>
                            <div class="col-sm-3">
                            	<textarea class="form-control" id="abstract" name="abstract" rows="6"></textarea>
                            </div>
                        </div>
                        
                        <div  class="form-group">
                            <label class="col-sm-3 control-label">编辑内容：</label>
                          	<div class="col-sm-9">
				    	   		<script id="editor" type="text/plain" name="content" style="width:862px;height:400px;"></script>
				    	 	</div>
					   </div>
					   
					   
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-3">
                                <button class="btn btn-primary" type="submit">提交</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <!--尾部-->
        <include file="Common/admin:footer"/>
    </div>
    <script>
    
	    //实例化编辑器
	    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
	    var ue = UE.getEditor('editor');
	    
        $('form').submit(function(){
            var name = $('#title').val();
            var sort = $("#author").val();
            var type = $('#typeid').val();
            if(type == 0){
            	layer.msg('请选择正确分类',{time:1000});
                return false;
            }
            if(name == ''){
                layer.msg('请填写名称',{time:1000});
                return false;
            }
            if(sort == ''){
                layer.msg('请填写作者',{time:1000});
                return false;
            }
            
        });
    </script>
</block>

